<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of UserController
 *
 * @author thanhdx
 */
class UserController extends Controller {

    //put your code here
    /* public function filters() {
      return array(
      'accessControl',
      );
      }

      public function accessRules() {
      return array(
      array('allow', // allow all users to perform 'index' and 'view' actions
      'actions' => array('index', 'view'),
      'users' => array('*'),
      ),
      array('allow', // allow authenticated user to perform 'create' and 'update' actions
      'actions' => array('create', 'update'),
      'users' => array('@'),
      ),
      array('allow', // allow admin user to perform 'admin' and 'delete' actions
      'actions' => array('admin', 'delete'),
      'users' => array('admin'),
      ),
      array('deny', // deny all users
      'users' => array('*'),
      ),
      );
      } */

    public function actionIndex() {
        
    }

    public function actionAddrole() {
        $model = new RoleForm();
        if (isset($_POST['RoleForm'])) {
            $role_name = trim((string)$_POST['RoleForm']['role']);
            
            $auth = Yii::app()->authManager;
            $role = $auth->createRole($role_name);
                       
            $auth->createOperation('createProject', 'create a new project');
            $role->addChild('createProject');
        }
        $this->render('add_role', array('model' => $model));
    }

}

?>
